package com.itheima.test01;

import java.util.Scanner;

public class ShuZu {

    public static void main(String[] args) {
      /*  //数组最大值
        int[] arr = {11,22,33,44,60};
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if(max < arr[i]){
                max = arr[i];
            }
        }
        System.out.println("max:"+max);
      */

      /*
        //数组元素求和
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        int[] arr = new int[5];
        //将键盘录入的数值存放到数组中
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第"+(i+1)+"个整数：");
            arr[i] = sc.nextInt();
        }

        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }

        System.out.println("整数和是："+ sum);
       */


        /*
        //查找数组中对应数字
        int[] arr = {12,65,35,99,108};
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个您想查找的数字：");
        int num = sc.nextInt();
        int index = -1;       //-1 代表没有找到
        for (int i = 0; i < arr.length; i++) {
            if(num==arr[i]){
                index=i;
                break;
            }
        }

        System.out.println(index);
        */


        /*
        //评委打分
        int[] arr = new int[6];
        int sum = 0;
        Scanner sc = new Scanner(System.in);

        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个评委的分数");
            int score = sc.nextInt();
            if (score >= 0 && score <= 100) {
                arr[i] = score;
            } else {
                System.out.println("您输入的成绩有错误，请重新输入!");
                i--;
            }
        }

        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }

        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }

        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }

        int avg = (sum - max - min) / 4;

        System.out.println("选手的最后得分：" + avg);
        */

//       print(10,20);

        int result = getMax(25,78);
        System.out.println(result);
    }


    //打印n-m之间所有奇数
    public static void print(int n, int m) {
        System.out.println("n-m之间的奇数有：");
        for (int i = n; i < m; i++) {
            if (i % 2 == 1) {
                System.out.println(i);
            }
        }
    }

    //获取两个数字中的较大值
    public static int getMax(int a, int b) {
        if(a>b){
            return a;
        }else{
            return b;
        }
    }

}
